<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>埋点监控</title>
</head>
<body>
    <div id="container">
        <!-- <div class="content">
            <input class="button1" type="button" value="点击抛出js错误" onclick="errorClick()" />
            <input class="button2" type="button" value="点击抛出promise错误" onclick="promiseErrorClick()" />
            <input class="button3" type="button" value="点击抛出资源加载错误" onclick="resourceErrorClick()" />
        </div>
        <div class="content">
            <input class="button1" type="button" value="点击抛出接口请求成功上报" onclick="sendSuccess()" />
            <input class="button2" type="button" value="点击抛出接口请求失败上报" onclick="sendError()" />
        </div> -->
        <div class="content">
            xxx
        </div>
    </div>
    <script>
        const errorClick = () => {
            window.hehe.error = 'aaa'
        }
        const promiseErrorClick = () => {
            new Promise((resolve, reject)=>{
                window.hehe.su7 = 'aaa'
            })
        }
        const resourceErrorClick = () => {
            const script = document.createElement('script');
            script.type = "text/javascript";
            script.src = "aaa.js";
            document.getElementsByTagName('head')[0].appendChild(script); 
        }
    </script>
    <script>
        const sendSuccess = () => {
            let xhr = new XMLHttpRequest;
            xhr.open('GET','/success',true);
            xhr.responseType = 'json';
            xhr.onload = () => {
                console.log(xhr.response);
            }
            xhr.send();
        }
        const sendError = () => {
            let xhr = new XMLHttpRequest;
            xhr.open('POST','/error',true);
            xhr.responseType = 'json';
            xhr.onload = () => {
                console.log(xhr.response);
            }
            xhr.onerror = (error) => {
                console.log(error);
            }
            xhr.send("name=liangzhai");
        }
    </script>
</body>
</html>